package com.suyx.job.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.suyx.job.entity.GoodsInfo;


/**
 * @Auther: lanyanhua
 * @Date: 2018/10/18 0018 11:34
 * @Description:
*/
@Repository
public interface GoodsInfoRepository extends JpaRepository<GoodsInfo,Integer> ,JpaSpecificationExecutor<GoodsInfo> {

	@Query(value = "select * from goods_info where goods_info.status = '0' and goods_info.role_id = :roleId and goods_info.goods_code = :goodsCode  limit 1",nativeQuery = true)
    GoodsInfo findByRoleIdAndGoodsCode(@Param("roleId") Integer roleId,@Param("goodsCode") Integer goodsCode);
	
	@Query(value = "select * from goods_info where goods_info.status = '0' and goods_info.role_id = :roleId and goods_info.goods_name = :goodsName  limit 1",nativeQuery = true)
    GoodsInfo findByRoleIdAndGoodsName(@Param("roleId") Integer roleId,@Param("goodsName") String goodsName);
}
	